<?php

class Application_Form_YearsStudent extends Validation_Form
{

  public function init()
  {
  	/*
  	 * data to form
  	 */

 	
  	$specialitiesDao = new Application_Model_Dao_Speciality();
  	$specialities = $specialitiesDao->getToSelect(); 
  	
  	$facultyDao = new Application_Model_Dao_Faculty();
  	$faculties = $facultyDao->getToSelect();
  	
  	$cathedralDao = new Application_Model_Dao_Cathedral();
  	$cathedrals = $cathedralDao->getToSelect(); 
  
  	$majorDao = new Application_Model_Dao_Major();
  	$majors = $majorDao->getToSelect();
  	
  	$userDao = new Application_Model_Dao_User();
  	$lecturers = $userDao->getToSelectLecturers();
  	
  	$studiesTypeDao = new Application_Model_Dao_StudiesType();
  	$studiesTypes = $studiesTypeDao->getToSelect();

  	
  	/*
  	 * form
  	 */
    $this->setName("zendForm");
    $this->setMethod('post');
    
	$id = new Zend_Form_Element_Hidden('id');
	$id->addFilter('Int');
	
	$typeForm = $this->createElement('hidden','typeForm');
	
	$shortName = $this->createElement('text', 'short_name');
    $shortName->setLabel('Skrócona nazwa roku')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ))
            ->addValidators(array(
                new Zend_Validate_NotEmpty(),
                //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
                //new Zend_Validate_Alpha()
            ));

	$study = new Zend_Form_Element_Select('studies_type_id');
   	$study->setLabel('Studia')
   	    		   ->setMultiOptions($studiesTypes)
   	    		   ->setRequired(true)
   	    		   ->addValidator('NotEmpty', true);

   	$speciality = new Zend_Form_Element_Select('speciality_id');
   	$speciality->setLabel('Specialność')
   	    		   ->setMultiOptions($specialities)
   	    		   ->setRequired(true)
   	    		   ->addValidator('NotEmpty', true);
   	
	$faculty = new Zend_Form_Element_Select('faculty_id');
   	$faculty->setLabel('Na wydziale')
   	    		   ->setMultiOptions($faculties);
   	    		      	    		   
    $cathedral = new Zend_Form_Element_Select('cathedral_id');
   	$cathedral->setLabel('Na katedrze')
   	    		   ->setMultiOptions($cathedrals)
   	    		   ->setRequired(true)
   	    		   ->addValidator('NotEmpty', true);
   	$tutor = new Zend_Form_Element_Select('tutor_id');
   	$tutor->setLabel('Opiekun roku')
   	    		   ->setMultiOptions($lecturers)
   	    		   ->setRequired(true)
   	    		   ->addValidator('NotEmpty', true);
   	    		   
   	    		   
   	$major = new Zend_Form_Element_Select('major_id');
   	$major->setLabel('Specjalizacja')
   	    		   ->setMultiOptions($majors)
   	    		   ->setRequired(true)
   	    		   ->addValidator('NotEmpty', true);
   	    		   
   	    		   
    $numberStudents = $this->createElement('text','number_students');
    $numberStudents->setLabel('Liczba studentów na roku')
         ->setRequired(TRUE)
         ->setAttrib('size', 30)
         ->addFilters(array(
            new Zend_Filter_StringTrim(),
            new Zend_Filter_StripNewlines(),
			new Zend_Filter_StripTags()
           ))
         ->addValidators(array(
            new Zend_Validate_NotEmpty(),
            //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
            //new Zend_Validate_Alpha()
            ));
     $numberSpecialities = $this->createElement('text','number_speciality');
   	 $numberSpecialities->setLabel('Liczba specialności na roku')
         ->setRequired(TRUE)
         ->setAttrib('size', 30)
         ->addFilters(array(
            new Zend_Filter_StringTrim(),
            new Zend_Filter_StripNewlines(),
			new Zend_Filter_StripTags()
           ))
         ->addValidators(array(
            new Zend_Validate_NotEmpty(),
            //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
            //new Zend_Validate_Alpha()
            ));
 
     $durationSemesters = $this->createElement('text','duration_semesters');
   	 $durationSemesters->setLabel('Liczba semestrów')
         ->setRequired(TRUE)
         ->setAttrib('size', 30)
         ->addFilters(array(
            new Zend_Filter_StringTrim(),
            new Zend_Filter_StripNewlines(),
			new Zend_Filter_StripTags()
           ))
         ->addValidators(array(
            new Zend_Validate_NotEmpty(),
            //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
            //new Zend_Validate_Alpha()
            ));
 
    /*
     * group lecture
     */        
    $groupLectureNumber = $this->createElement('text', 'groupLectureNumber');
    $groupLectureNumber->setLabel('Ilość grup wykładowych')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ))
            ->addValidators(array(
                new Zend_Validate_NotEmpty(),
                //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
                //new Zend_Validate_Alpha()
            ));

	$groupLectureName = $this->createElement('text', 'groupLectureName');
    $groupLectureName->setLabel('Nazwa grupy wykładowej')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ));
            
    $groupLectureNumberStudents = $this->createElement('text', 'groupLectureNumberStudents');
    $groupLectureNumberStudents->setLabel('Liczebność grupy wykładowej')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ))
            ->addValidators(array(
                new Zend_Validate_NotEmpty(),
                //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
                //new Zend_Validate_Alpha()
            ));	
            
   	/*
   	 * group laboratory
   	 */
    $groupLaboratoryNumber = $this->createElement('text', 'groupLaboratoryNumber');
    $groupLaboratoryNumber->setLabel('Ilość grup laboratoryjnych')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ))
            ->addValidators(array(
                new Zend_Validate_NotEmpty(),
                //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
                //new Zend_Validate_Alpha()
            ));

	$groupLaboratoryName = $this->createElement('text', 'groupLaboratoryName');
    $groupLaboratoryName->setLabel('Nazwa grupy laboratoryjnej')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ));
            
    $groupLaboratoryNumberStudents = $this->createElement('text', 'groupLaboratoryNumberStudents');
    $groupLaboratoryNumberStudents->setLabel('Liczebność grupy laboratoryjnej')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ))
            ->addValidators(array(
                new Zend_Validate_NotEmpty(),
                //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
                //new Zend_Validate_Alpha()
            ));	       

     /*
      * group exercise
      */  
 	$groupExerciseNumber = $this->createElement('text', 'groupExerciseNumber');
    $groupExerciseNumber->setLabel('Ilość grup ćwiczeniowych')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ))
            ->addValidators(array(
                new Zend_Validate_NotEmpty(),
                //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
                //new Zend_Validate_Alpha()
            ));

	$groupExerciseName = $this->createElement('text', 'groupExerciseName');
    $groupExerciseName->setLabel('Nazwa grupy ćwiczeniowej')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ));
            
    $groupExerciseNumberStudents = $this->createElement('text', 'groupExerciseNumberStudents');
    $groupExerciseNumberStudents->setLabel('Liczebność grupy ćwiczeniowej')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ))
            ->addValidators(array(
                new Zend_Validate_NotEmpty(),
                //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
                //new Zend_Validate_Alpha()
            ));	
            
            
     /*
      * submit
      */       
   	$submit = new Zend_Form_Element_Submit('submit');
	$submit->setAttrib('id', 'submit');
    
    $this->addElements(array(
    	$id,
    	$shortName,
    	$study,
    	$faculty,
    	$cathedral,
    	$speciality,
    	$tutor,
        $numberStudents,
        $numberSpecialities,
        $durationSemesters,
        
        //$groupLectureNumber,
        //$groupLectureName,
        //$groupLectureNumberStudents,
        //$groupLaboratoryNumber,
        //$groupLaboratoryName,
        //$groupLaboratoryNumberStudents,
        //$groupExerciseNumber,
        //$groupExerciseName,
        //$groupExerciseNumberStudents,
       // $abundanceGroup,
        $typeForm,      
        $submit,
        ));
  }


}

	